home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-12-17 | 6.5 KB | 181 lines | [TEXT/MPS ] |
- #
- # ****************************************************************************
- #
- # File Name: ThinkC.vu
- #
- # Contains: Quick look test script for Think C version 5.0.4
- #
- # Written by: Kevin Avoy, Ken Landreth, Michael Leong, Gil Spencer et al
- #
- # Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
- #
- # ****************************************************************************
- # C h a n g e H i s t o r y (most recent first):
- # ****************************************************************************
- #
- # Vers Date Author Description
- # ---- -------- ------ ---------------------------------------------
- # <1.0.5> 9/30/93 KTA Initialize gFileName prior to gApptitle being updated by
- # launchTwitch().
- # <1.0.2> 6/16/93 NAGA Renaming InitGlobals(ScriptLevel)to InitGlobals(ScriptLevel)
- # <1+> 5/25/93 NAGA Adding header and porting old files to follow new standards
- #
- # ****************************************************************************
- #
-
-
-
- ########################################################################
- # External libraries
- #=======================================================================
- Libraries "Output.Lib", "DoTasks.Lib","Draw.Lib","StandardFile.Lib","UserInterface.Lib","DA.Lib", "Font.Lib", "Globals.Lib", "LaunchQuit.Lib", "TCS.Lib";
-
-
- #########################################################################
- ######## Application Specific Tasks
- #########################################################################
-
- #########################################################################
- # InitAppGlobals()
- #========================================================================
- # Author: KA
- # Description: Sets up tools and fonts for Think C. This task
- # must be called first.
- # Parameters: None
- # Returns: Nothing
- # Examples: InitAppGlobals()
- #========================================================================
- # History:
- #
- ########################################################################
- task InitAppGlobals()
- begin
-
- logstr("setting up {global gApptitle}'s globals");
- global gScreenInset := {0,20,0,0}; # Screen inset
- global gPaletteList := {};
- global gToolList := {};
- end; # InitAppGlobals
-
- #########################################################################
- # ThinkCScrapText()
- #========================================================================
- # Author: ML
- # Description: Paste text into Think C Document
- # Parameters: None
- # Returns: Nothing
- # Examples: ThinkCScrapText();
- # Assumptions: None
- # Applications: Think C
- #========================================================================
- # History:
- #
- #########################################################################
- task ThinkCScrapText()
- begin
- logstr("Setting up for ScrapText");
- TypeStr("/*"); # Commment out Scrapbook paste
- Scrapbook(global kScrapTEXT);
- TypeStr("*/"); # Commment out Scrapbook paste
- end;
-
- #########################################################################
- # SimpleProgram()
- #========================================================================
- # Author: AM
- # Description: Create and run a simple program
- # Parameters: None
- # Returns: Nothing
- # Examples: Views();
- # Assumptions: None
- # Applications: THINK C
- #========================================================================
- # History: Adapted from Think Pascal Program 1/22/92 AEM
- # KTA 12/08/92 Added Ansi library and running Hasta
- #########################################################################
- task SimpleProgram()
- begin
- Temp := Global gAppVerify; # Disable Appverify because running will cause an application switch
- gAppVerify := 0;
-
- LogStr('Creating and Compiling a Simple Program',3);
- SelectMenuItem("Add", "Source"); # add doc to the project
- # add ANSI to the project
- SelectMenuItem("Add…", "Source");
- TypeStr('C Lib');
- SpecialKey(Returnkey,"Return Key");
- TypeStr('ANSI');
- SpecialKey(Returnkey,"Return Key");
- SelectButton("Done");
-
- TypeList({ '/*',
- ' * Hasta.c',
- '* A simple program in C',
- '*/',
- '',
- '#include <stdio.h>',
- 'void main() {',
- 'printf("Hasta La Vista, Baby!!!");',
- '}' }, 1, 1);
-
- SelectMenuItem("Compile","Source");
- SelectMenuItem("Save","File");
- SelectMenuItem("Run", "Project"); # Loading and compiling libraries is
- # too complex a process for a quick look.
-
- ## Various dialog dismissal
- SpecialKey(returnKey,"Return Key"); # return after project runs
- SpecialKey(returnKey,"Return Key"); # return after project runs
- gAppVerify := Temp;
- end;
-
- ################################################################################
- #################### Main script ####################
- ################################################################################
- script ThinkC (ScriptLevel:= -1)
- begin
- InitGlobals(ScriptLevel); # initialize your general globals
- InitDraw();
- InitFonts();
- global gApptitle := "Think C";
- global gAppVersion := '5'; # version of app you will be running
- global gFileName := "@!@-{gBuildVers}-{gAppTitle}.c";# This is used in SaveAs when saving files
- SuiteStart('ThinkC.vu'); # begin a new test suite
- if LaunchTwitch("{gAppTitle}",gAliasDirectory) # launch or twitch to your app
- begin
- global gProjectName := "@!@-{gBuildVers}-{gAppTitle}.proj";
- global gCustomScrapText:= task ThinkCScrapText; # define app specific task
- InitAppGlobals(); # init app specific globals
- (*
- *)
-
- ## Begin with StandardFile
- # if(match[button t:'New'])
- # begin
- # SelectButton('New');
- # SaveAs(global gProjectName);
- # end;
-
- DoSetUpApp("Cancel",-1,{'New Project…','Project'},,,,0); # first set up project
- SaveAs(global gProjectName); # save the project
-
- DoSetUpApp(,-1,,0,1); # then set up the file
-
- SimpleProgram();
- ##DoText(0); # No Font menus in Think C
- DoWindow(); # Vertical scroll could fail if nothing in document
- ##DoDraw(0); # No Draw Tools in Think C
-
- DoCloseApp(1,-1); # The About Box disables VU
- LogStr("############################# LIMITATIONS: ############################");
- LogStr("No Draw Tools or Font menus in Think C, so DoText and DoDraw not done.");
- LogStr("Vertical scroll will fail because doc isn't long enough");
- LogStr("Final save will fail because we've already saved before executing program");
- end; # if LaunchTwitch("{gAppTitle}",gAliasDirectory)
- SuiteEnd();
- end; # script ThinkC
-
- ## Still needed
- # 1) Vertical scroll could fail if nothing in document
- # 4) The revert save does not work because the document is already saved
-